<%@page import="auxilary.Actions"%>
<%@page import="auxilary.Constants"%>
<%@page import="auxilary.Links"%>
<%@page import="entities.Course"%>
<%@page import="java.util.List"%>
<%@page import="entities.User"%>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<%
	User user = (User)request.getSession().getAttribute("user");
	List<Course> list = (List<Course>)request.getAttribute("list");
	String listName = (String)request.getAttribute("listName");
%>
<jsp:include page="/frames/start.jsp" />
	<%=Links.Css.USER %>
	<%=Links.Css.COURSE %>
<jsp:include page="/frames/frame.jsp" />
			<h1>My <%=listName %></h1>
		   <% if (list.isEmpty()) { %>
		   	<br />
		    <center><h4>You have no courses in your <%=listName %><br /><br />Find courses <a href="<%=Links.Pages.SEARCH %>">here</a></h4></center>
		   <% } else {%>
			<table>
				<tr>
					<th class="course-name">Name</th>
					<th class="course-points">Points</th>
					<th class="course-availabel">Spots</th>
					<th class="course-group">Group</th>
					<th></th>
				</tr>
			   <% for (Course course : list) { %>
				<tr id="">
					<td class="course-name"><%=Constants.truncate(course.getName(),20) %></td>
					<td class="course-points"><%=course.getCredits() %></td>
					<td class="course-points"><%=course.getTaken() %>/<%=course.getCapacity() %></td>
					<td class="course-group"><%=Constants.truncate(Constants.Group.getName(course.getGroupId()),14) %></td>
					<td class="course-view" onclick="window.location.href='<%=Links.Pages.COURSES_BASE %><%=course.getId() %>';">view</td>
				</tr>
			   <% } %>
			</table>
		   <% } %>
<jsp:include page="/frames/end.jsp" />